home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5717 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news1.cle.ab.com!usenet
  2. From: don.phillips@ab.com (Donald-Anthony C. Phillips)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Best way to store in program messages?
  5. Date: Tue, 20 Feb 1996 17:48:56 GMT
  6. Organization: The Allen-Bradley Co., Inc
  7. Distribution: inet
  8. Message-ID: <4gcn0j$p0g@news1.cle.ab.com>
  9. References: <4gckb4$77e@news.mistral.co.uk>
  10. NNTP-Posting-Host: abpc386.cle.ab.com
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. One method would be to keep a text file of messages and message codes,
  14. where the message code would be the index.  You could then create a
  15. function which extracted the message text based on the code:
  16.  
  17. Text File:
  18.  
  19. 0001Message number 1
  20. 0002Message number 2
  21. 0003Message number 3
  22.  
  23. Char *GetMessage(char *messageindex)
  24. {    open file
  25.     find message based on messageindex
  26.     if not found return NULL
  27.     return(message)
  28.  
  29. }
  30. Of course this is p-code, but hopefully you get the jist.  Once you
  31. get into indexing, there exist many options for handling the index
  32. search and extraction.
  33.  
  34. Hope this helps!!
  35.     
  36. Donald-Anthony C. Phillips
  37. Programmer/Analyst
  38.  Rockwell  Automation
  39.        ---------------------------------------
  40.         Allen-Bradley
  41. don.phillips@ab.com
  42.  
  43.